package com.qfedu.labsystem.controller;

import com.qfedu.labsystem.entity.bo.RightBO;
import com.qfedu.labsystem.entity.vo.ResultOBJ;
import com.qfedu.labsystem.service.RightService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName RightController
 * @Author ykx
 * @Date 2024/4/5 12:01
 * @Version 1.0
 */
@RestController
@RequestMapping("/adminapi/rights")
public class RightController {

    @Autowired
    private RightService rightService;

    @GetMapping("/list")
    public List<RightBO> getRightList() {
        return rightService.getRightList();
    }

    @PutMapping("/{id}")
    public ResultOBJ updateRightList(@PathVariable Integer id, @RequestBody RightBO rightBO) {
        rightBO.setId(id);
        return ResultOBJ.success(rightService.updateRight(rightBO));
    }

    @DeleteMapping("/{id}")
    public ResultOBJ deleteRight(@PathVariable Integer id) {
        return ResultOBJ.success(rightService.deleteRight(id));
    }

}
